import { createRouter, createWebHashHistory } from 'vue-router'
import TabBar from '@/views/tabbar/index.vue'
import NotFound from '@/views/404/index.vue'
import Layout from '@/views/Layout.vue'

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            component: TabBar,
            
            children: [
                {
                    path: 'home',
                    name: 'home',
                    component: () => import('@/views/tabbar/home.vue')
                },                
                {
                    path: '/shop',
                    name: 'shop',
                    component: () => import('@/views/tabbar/shop.vue')
                },
                {
                    path: '/users',
                    name: 'users',
                    component: () => import('@/views/tabbar/users.vue')
                }                
            ]
        },
        {
            path: '/my',
            name: 'my',
            component: Layout,
            children: [
                {
                    path: 'favorite',
                    component: () => import('@/views/users/index.vue'),
                    meta: {
                        title: '收藏'
                    }
                }
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('@/views/users/login.vue'),
            meta: {
                title: '登录'
            }
        },
        {
            path: '/:mathAll(.*)',
            name: 'notfound',
            component: NotFound
        }
    ]
})

export default router